<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no" /> 
		<title>拾米下载</title>
		<script src="js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>

		<style type="text/css">
			*{margin: 0;padding: 0;}
			body{width: 100%;height: 100%;}
			.box{position: relative;margin: 0;}
			.android,.ios{font-size: 15px;width:160px;height: 44px;background-color: #fff;border-radius: 100px;box-shadow: 0 2px 0 0 #BB0D04;display: flex;justify-content: center;align-items: center;}
			.android{z-index: 30;}
			.ios{z-index: 30;}
			.andriodPic,.iosriodPic{}
			.andriodPic{width: 21px;height: 25px;margin-right: 5px;}
			.iosriodPic{width: 17px;height: 21px;margin-right: 5px;}
			.bg{width: 100%;height: 100%;display: block;}
			img{display: block}
			.btn{display: flex;justify-content: space-around;align-content: center;position: absolute;bottom: 6%;width: 100%;}
			.pic{display: block;width: 100%;margin: -0.5px 0 0}
			.layer{width: 100%;height: 100%;position: fixed;top: 0;left: 0;background: rgba(0,0,0,0.7);z-index: 300;display: none}
			.layer img{width: 260px;height:176px;margin: 10px auto;display: block;}
			.nickname{width: 200px; position: absolute;top: 32%;font-size: 18px;color: #ff2b3d;left: 100px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
		</style>
		
	</head>
	<body>
		<div class="down">
			<div class="box" id="androidDownload">

				<img src="image/bg.png" class="bg">
				<div class="nickname"> 您的好友 <span id="nickname"></span> </div>
				<div class="btn">
					<div class="android" id="androidDownload">
						<img src="image/android.png" class="andriodPic" />
						<span>安卓下载</span>
					</div>
					<div class="ios" id="iosDownload">
						<img src="image/ios.png" class="iosriodPic"/>
						<span>IOS下载</span>
					</div>
					
				</div>
			</div>
			<img src="image/01.jpg" class="pic">
			<img src="image/02.jpg" class="pic">
			<img src="image/03.jpg" class="pic">
			<img src="image/04.jpg" class="pic">
			<img src="image/05.jpg" class="pic">
			<img src="image/06.png" class="pic">
		</div>
		<div class="layer">
			<img src="image/warn.png" >
		</div>
		<div style="display:none">
			<script type="text/javascript" src="https://s23.cnzz.com/z_stat.php?id=1277792086&web_id=1277792086"></script>
		</div>
	</body>
</html>

<script type="text/javascript" charset="UTF-8" src="//res.cdn.openinstall.io/openinstall.js"></script>
<script type="text/javascript">
		var u = navigator.userAgent;
		var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
		var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
		
		var ua = window.navigator.userAgent.toLowerCase();
		
		//正则截取url上的参数 
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if ( r != null ){
				 return decodeURIComponent(r[2]);
			}else{
				 return null;
			} 
		}
		var oSpan = document.getElementById('nickname')
		
		oSpan.innerHTML = getQueryString('n')
		
    var data = OpenInstall.parseUrlParams();//openinstall.js中提供的工具函数，解析url中的所有查询参数
    new OpenInstall({

        appKey : "dth37l",
        onready : function() {
            var m = this, androidbutton = document.getElementById("androidDownload"),iosbutton = document.getElementById("iosDownload");
            androidbutton.style.visibility = "visible";
            iosbutton.style.visibility = "visible";

            /*在app已安装的情况尝试拉起app*/
            m.schemeWakeup();
            /*用户点击某个按钮时(假定按钮id为downloadButton)，安装app*/
            
			iosbutton.onclick = function() {
                m.wakeupOrInstall();
                return false;
            }
			if(isAndroid){
								
				androidbutton.onclick = function() {
					m.wakeupOrInstall();
					return false;
				}
				
			}else if(isiOS){
				
				if (ua.match(/MicroMessenger/i) == 'micromessenger') { //微信
					var wechatInfo = navigator.userAgent.match(/MicroMessenger\/([\d\.]+)/i)
					var wechatVersion = wechatInfo[1] // 获取微信版本号
					iosbutton.onclick = function() {
						
						if(wechatVersion >= '7.0.5'){
							$('.layer').show()
						}else{
							
							m.wakeupOrInstall();
							return false;
						}
						
					}
				} else {
					
					iosbutton.onclick = function() {

						m.wakeupOrInstall();
						return false;
					}
				}
			}
        }
    }, data);


</script>